package com.ouc.pampas;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpSession;

import com.ouc.openplatform.pampas.SessionManager;
public class ClusterHttpServletRequestWrapper
  extends HttpServletRequestWrapper
{
  private SessionManager sessionService;
  private String sessionId;
  private HttpSession httpSession;
  private ServletContext servletContext;
  
  public ClusterHttpServletRequestWrapper(ServletContext servletContext, HttpServletRequest request, String sessionId, SessionManager sessionService)
  {
    super(request);
    this.sessionId = sessionId;
    this.sessionService = sessionService;
    this.servletContext = servletContext;
  }
  
  public HttpSession getSession(boolean create)
  {
    if (this.httpSession == null) {
      this.httpSession = new ClusterHttpSessionWrapper(this.sessionId, this.servletContext, this.sessionService);
    }
    return this.httpSession;
  }
  
  public HttpSession getSession()
  {
    return getSession(false);
  }
}
